<template>
  <el-dialog title="单证定义修改" :visible.sync="dialogFormVisible" width="80%">
      <el-form :label-position="labelPosition" label-width="140px" :model="formData" ref="formData">
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="单证编码" size="mini":required="true">
              <el-input v-model="formData.certifyCode" clearable filterable placeholder="010201">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="单证名称" size="mini":required="true">
              <el-input v-model="formData.certifyName"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="单证版本" size="mini":required="true">
              <el-input v-model="formData.certifyEdition" clearable filterable placeholder="202101">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="管理机构" size="mini":required="true">
              <el-select v-model="formData.code2" clearable filterable placeholder="86-总部">
                <el-option value="86-总部"></el-option>
                <el-option value="8601-分公司"></el-option>
                <el-option value="860101-支公司"></el-option>
                <el-option value="86010101-营销部"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="单证业务类型" size="mini":required="true">
              <el-select v-model="formData.certifyOperType" filterable placeholder="请选择">
                <el-option
                  v-for="item in certifyOperTypeList"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <!--<span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>-->
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="单证状态" size="mini":required="true">
              <el-select v-model="formData.state" filterable placeholder="请选择">
                <el-option
                  v-for="item in stateList"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="是否有号单证" size="mini":required="true">
              <el-select v-model="formData.haveNumber" filterable placeholder="请选择">
                <el-option
                  v-for="item in isChecked"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="单证号码长度" size="mini">
              <el-input v-model="formData.certifyLength"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="是否回收标志" size="mini":required="true">
              <el-select v-model="formData.tackBackFlag" filterable placeholder="请选择">
                <el-option
                  v-for="item in isChecked"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="是否限制回销期" size="mini":required="true">
              <el-select v-model="formData.haveLimit" filterable placeholder="请选择">
                <el-option
                  v-for="item in isChecked"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="个人渠道" size="mini">
              <el-input v-model="formData.maxUnit1"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="非个人渠道" size="mini">
              <el-input v-model="formData.maxUnit2"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="是否限量领用" size="mini":required="true">
              <el-select v-model="formData.haveLimit" filterable placeholder="请选择">
                <el-option
                  v-for="item in isChecked"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="个人渠道" size="mini">
              <el-input v-model="formData.maxUnit1"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="非个人渠道" size="mini">
              <el-input v-model="formData.maxUnit2"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="是否有有效使用期限" size="mini":required="true">
              <el-select v-model="formData.haveValidate" filterable placeholder="请选择">
                <el-option
                  v-for="item in isChecked"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="个人渠道" size="mini">
              <el-input v-model="formData.validate1"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="非个人渠道" size="mini">
              <el-input v-model="formData.validate2"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="单证单价" size="mini":required="true">
              <el-input v-model="formData.certifyPrice"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="装箱规格" size="mini">
              <el-input v-model="formData.cartonSize">
                <span>(/箱)</span></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="装订规格" size="mini">
              <el-input v-model="formData.bindingSize">
                <span>(/本)</span></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="使用渠道" size="mini":required="true">
              <el-select v-model="formData.useTheChannel" filterable placeholder="请选择">
                <el-option
                  v-for="item in channelList"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="单证初始号" size="mini">
              <el-input v-model="formData.startNo"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="库存数量" size="mini">
              <el-input v-model="formData.certifyStockxiugai"></el-input>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="16">
            <el-form-item label="注释" size="mini">
              <el-input type="textarea" rows="2" v-model="formData.note" ref="textarea"
                        max-length="50"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="上传地址" size="mini">
              <el-input type="file" v-model="formData.fileName" @click="uploadData"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="使用部门" size="mini":required="true">
              <el-select v-model="formData.useManageCom" filterable placeholder="财务部">
                <el-option
                  v-for="item in useManageComList"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="管理部门" size="mini":required="true">
              <el-select v-model="formData.useManageCom" filterable placeholder="财务部">
                <el-option
                  v-for="item in useManageComList"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="是否单证审批" size="mini":required="true">
              <el-select v-model="formData.checked1" v-on:change="showCheckedType1" filterable placeholder="否">
                <el-option
                  v-for="item in isChecked"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6" ref="checkedType1" v-if="showType1">
            <el-form-item label="定义审批规则" size="mini">
              <el-select v-model="formData.checkedType1" filterable placeholder="否">
                <el-option
                  v-for="item in checkedTypeList1"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="是否征订审批" size="mini":required="true">
              <el-select v-model="formData.checked2" v-on:change="showCheckedType2" filterable placeholder="否">
                <el-option
                  v-for="item in isChecked"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6" ref="checkedType2" v-if="showType2">
            <el-form-item label="征订审批规则" size="mini">
              <el-select v-model="formData.checkedType2" filterable placeholder="请选择">
                <el-option
                  v-for="item in checkedTypeList2"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="10">
            <el-form-item label="发放流程" size="mini">
              <el-select v-model="formData.handOut" filterable placeholder="请选择">
                <el-option
                  v-for="item in handOutList"
                  :key="item.code"
                  :label="item.codeName"
                  :value="item.code">
                  <span>{{ item.code }}</span> - <span>{{ item.codeName }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        </el-row>
      </el-form>
      <div align="right">
        <el-button type="primary" @click="dialogFormVisible = false,add" size="small">修改</el-button>
        <el-button type="warning" @click="dialogFormVisible = false,resetForm('formData')" size="small">重置
        </el-button>
      </div>
  </el-dialog>
</template>

<script>
    export default {
        name: "edit",
        data(){
          return{
            tableHeight: document.body.clientHeight - 245,
            certifyEdition: 202101,
            isShowSingles: true,
            showType: false,
            labelPosition: "right",
            dialogFormVisible: false,
            dialogTitle:"添加",
            formData: {
              certifyOperType1: '',
              certifyCode: '010201',
              certifyEdition: 202101,
              certifyName: '补充文件',
              manageCom: '',
              userManageCom: '1',
              certifyType: '有价单证',
              certifyOperType: '契约',
              haveNumber: '是',
              haveNumber1: '',
              state: '1',
              state1: '',
              checked1: '',
              checkedType1: '',
              checked2: '',
              checkedType2: '',
              haveLimit: '2',
              haveLimit1: '',
              maxUnit1: '',
              maxUnit2: '',
              certifyLength: '6',
              certifyLength1: '',
              tackBackFlag: '1',
              tackBackFlag1: '',
              haveValidate: '1',
              haveValidate1: '',
              validate1: '30',
              validate2: '70',
              validate3: '',
              validate4: '',
              certifyPrice: '0.2',
              certifyPrice1: '',
              cartonSize: '25',
              bindingSize: '25',
              cartonSize1: '',
              bindingSize1: '',
              useTheChannel: '2',
              useTheChannel1: '',
              certifyStock: '',
              certifyStockxiugai: '5',
              startNo: '',
              handOut: '1',
              handOut1: '',
            },
            stateList: [
              {code: '1', codeName: '启用'},
              {code: '2', codeName: '停用'}
            ],
            useManageComList: [
              {code: '1', codeName: '财务部'},
              {code: '2', codeName: '业务部'}
            ],
            useManageComList1: [
              {code: '1', codeName: '总部'},
              {code: '2', codeName: '分部'},
              {code: '3', codeName: '支部'},
              {code: '4', codeName: '营销部'},
            ],
            certifyOperTypeList: [{code: '1', codeName: '契约'}, {code: '2', codeName: '保全'}, {code: '3', codeName: '理赔'}],
            certifyTypeList: [{code: '1', codeName: '有价单证'}],
            isChecked: [{code: '1', codeName: '是'}, {code: '2', codeName: '否'}],
            channelList: [{code: '1', codeName: '个人'}, {code: '2', codeName: '团体'}, {code: '3', codeName: '银行'}, {
              code: '4',
              codeName: '中介'
            }, {code: '5', codeName: '网销'}],
            checkedTypeList1: [{code: '1', codeName: '分公司 -> 总公司'}],
            checkedTypeList2: [{code: '1', codeName: '支公司 -> 分公司 -> 总公司'}, {code: '2', codeName: '分公司 -> 总公司'}],
          }
        }
    }
</script>

<style scoped>

</style>
